package stream;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

/**
 * @package stream
 * @Class Test
 * @Description TODO
 * @Author zhangxinhua
 * @Date 19-10-29 上午11:35
 */
public class Test {
    public static void main(String[] args) {
        LocalTime late = LocalTime.of(23, 59, 59);
        System.out.println(late);       // 23:59:59

        DateTimeFormatter germanFormatter =
                DateTimeFormatter
                        .ofLocalizedTime(FormatStyle.SHORT)
                        .withLocale(Locale.GERMAN);

        LocalTime leetTime = LocalTime.parse("13:37", germanFormatter);
        System.out.println(leetTime);   // 13:37

    }

    public static void paralle(List<String> list) {
        long startTime = System.nanoTime();

        long count = list.parallelStream().sorted().count();

        System.out.println(count);

        long endTime = System.nanoTime();
        long l = TimeUnit.NANOSECONDS.toMillis((endTime - startTime));
        System.out.println(String.format("swquential sort took : %d ms", l));
    }

    public static  void series(List<String> list) {
        long startTime = System.nanoTime();

        long count = list.stream().sorted().count();

        System.out.println(count);

        long endTime = System.nanoTime();
        long l = TimeUnit.NANOSECONDS.toMillis((endTime - startTime));
        System.out.println(String.format("swquential sort took : %d ms", l));
    }
}
